package com.example.day13;

import java.text.ParseException;
import java.util.Date;

/**
 * @author Lenovo
 */
public class DateDemo {
    public static void main(String[] args) throws ParseException {
        Date d = new Date();
        String s1 =DateUtils.dateToString(d,"yyyy-MM-dd HH:mm:ss");
        System.out.println(s1);
        String s2 =DateUtils.dateToString(d,"yyyy-MM-dd HH:mm:ss");
        System.out.println(s2);
        String s3 =DateUtils.dateToString(d,"yyyy-MM-dd HH:mm:ss");
        System.out.println(s3);
        System.out.println("-------");
        String s="2020-01-01 12:12:12";
        Date d1 = DateUtils.stringToDate(s,"yyyy-MM-dd HH:mm:ss");
        System.out.println(d1);
    }
}
